package com.note.app.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.note.common.domain.User;
import org.apache.ibatis.annotations.*;

/**
 * 用户数据访问接口
 * 基于MyBatis-Plus实现数据库操作
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
    
    /**
     * 根据用户名查询用户
     * 
     * @param username 用户名
     * @return 用户实体
     */
    @Select("SELECT * FROM user WHERE username = #{username} AND deleted = 0 LIMIT 1")
    User findByUsername(@Param("username") String username);
    
    /**
     * 根据邮箱查询用户
     * 
     * @param email 邮箱
     * @return 用户实体
     */
    @Select("SELECT * FROM user WHERE email = #{email} AND deleted = 0 LIMIT 1")
    User findByEmail(@Param("email") String email);
    
    /**
     * 根据手机号查询用户
     * @param mobile 手机号
     * @return 用户信息
     */
    @Select("SELECT * FROM user WHERE mobile = #{mobile} AND deleted = 0 LIMIT 1")
    User findByMobile(@Param("mobile") String mobile);
} 